package cn.com.yang.serializable;

import org.apache.avro.Schema;
import org.apache.avro.specific.AvroGenerated;
import org.apache.avro.specific.SpecificRecord;
import org.apache.avro.specific.SpecificRecordBase;
import org.apache.avro.specific.SpecificRecordBuilderBase;

/**
 * @Author 杨亿金
 * @Date 2021/12/28 22:38
 * @CopyRight
 * @Version
 */
@AvroGenerated
@SuppressWarnings("all")
public class AvroUser extends SpecificRecordBase implements SpecificRecord {

    @Deprecated public CharSequence userName;

    @Deprecated public CharSequence address;
    @Deprecated private Integer age;
    public static final Schema schema = new Schema.Parser().parse("{\"namespace\": \"user.avro\",\n" +
            "  \"type\": \"record\",\n" +
            "  \"name\": \"AvroUser\",\n" +
            "  \"fields\": [\n" +
            "    {\"name\": \"userName\", \"type\": \"string\"},\n" +
            "    {\"name\": \"address\",  \"type\": \"string\"},\n" +
            "    {\"name\": \"age\", \"type\": \"int\"}\n" +
            "  ]\n" +
            "}");

    public AvroUser(){}

    public AvroUser(CharSequence userName, CharSequence address, int age) {
        this.userName =userName;
        this.address =address;
        this.age =age;
    }



    @Override
    public String toString() {
        return "AvroUser{" +
                "userName='" + userName + '\'' +
                ", address='" + address + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public void put(int i, Object v) {

    }

    @Override
    public Object get(int i) {
        return null;
    }

    @Override
    public Schema getSchema() {
        return schema;
    }


    public static class Builder extends SpecificRecordBuilderBase<AvroUser> {
        private String userName;
        private String address;
        private int age;
        protected Builder(Schema schema) {
            super(schema);
        }


        public Builder userName(String userName) {
            this.userName = userName;
            return this;
        }

        public Builder address(String address) {
            this.address = address;
            return this;
        }

        public Builder age(int age) {
            this.age = age;
            return this;
        }

        @Override
        public AvroUser build() {
            return null;
        }
    }

}
